#include <iostream>

using namespace std;

const int N = 110;
int n , x;
int a[N];

int main()
{
    cin >> n;
    for(int i = 1;i <= n;i ++)
    {
        cin >> a[i];
        x += a[i];
    }
    x /= n;
    int ret = 0;
    for(int i = 1;i <= n;i ++)
    {
        if(a[i] == x) continue;
        ret ++;
        a[i + 1] -= (x - a[i]);
    }
    cout << ret << endl;
    return 0;
}